home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir35 / ccdf100.zip / CCDF.DOC < prev    next >
Text File  |  1994-01-18  |  11KB  |  279 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                               +--------------+
  7.                               |              |
  8.                               |              |
  9.                               |   C.C.D.F.   |
  10.                               |              |
  11.                               |              |
  12.                               +--------------+
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                               A DOS Utility to
  19.  
  20.                       Columnify Comma Delimited Files
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                              Copyright (C) 1994
  27.  
  28.  
  29.                                      by
  30.  
  31.  
  32.                              Pinnacle Software
  33.                              CP386 Mount Royal
  34.                              QC Canada H3P 3C6
  35.  
  36.  
  37.  
  38.  
  39.  
  40.                            Phone  (514) 345-9578
  41.                            BBS    (514) 345-8654
  42.                            CompuServe 70154,1577
  43.  
  44.  
  45.  
  46.  
  47.  
  48.     CCDF is distributed as Shareware:  you may use CCDF free of charge, or
  49.     distribute copies to others, with the proviso that CCDF may be used or
  50.     distributed ONLY in its complete and unaltered form.
  51.  
  52.  
  53.  
  54.  
  55.                           ========================
  56.                           WHY C.C.D.F. WAS WRITTEN
  57.                           ========================
  58.  
  59.  
  60.     A few days ago, I was astonished to discover that a well-known
  61.     spreadsheet program was incapable of reading the familiar "comma-
  62.     delimited" format.  That is to say, it couldn't read an ordinary text
  63.     file with the data fields broken up like this:
  64.  
  65.  
  66.     +---------------------------------------------------------------------+
  67.     |                                                                     |
  68.     |                 "CARRIER","ZIP",23809,"01-10-94"                    |
  69.     |                 "DASI","ZIP",21083,"01-10-94"                       |
  70.     |                 "FORAGE","ZIP",36867,"01-10-94"                     |
  71.     |                 "FREE","ZIP",109669,"01-10-94"                      |
  72.     |                                                                     |
  73.     |                                                                     |
  74.     | Fig. 1 -- Sample of comma-delimited data                            |
  75.     +---------------------------------------------------------------------+
  76.  
  77.  
  78.     In a comma-delimited file, character fields are enclosed in double
  79.     quotation marks, while numeric data is presented as-is.  Each field is
  80.     delimited (i.e. separated) by a comma.  The sample above (Fig. 1)
  81.     represents the following four fields:
  82.  
  83.  
  84.     +---------------------------------------------------------------------+
  85.     |                                                                     |
  86.     |                  CARRIER  ZIP   23809  01-10-94                     |
  87.     |                  DASI     ZIP   21083  01-10-94                     |
  88.     |                  FORAGE   ZIP   36867  01-10-94                     |
  89.     |                  FREE     ZIP  109669  01-10-94                     |
  90.     |                                                                     |
  91.     | Fig. 2 -- Sample of columnar data                                   |
  92.     +---------------------------------------------------------------------+
  93.  
  94.  
  95.     ... which just happens to be one of my directories.  The content of the
  96.     data is not the point, here; it's the FORMAT that concerns us.
  97.  
  98.  
  99.     Many people exchange data in comma-delimited format, but some programs
  100.     don't read it.  Fortunately, some programs that will not read comma-
  101.     delimited data WILL read columnar data (i.e. data arranged in columns,
  102.     as in Fig. 2).  That's where CCDF comes in...
  103.  
  104.  
  105.  
  106.                               ================
  107.                               INTRODUCING CCDF
  108.                               ================
  109.  
  110.  
  111.     CCDF ("Columnify Comma-Delimited Files") will read a comma-delimited
  112.     text file and output the fields in columns.  The format of the command
  113.     is as follows:
  114.  
  115.                         CCDF input-file output-file
  116.  
  117.     For example, to process the comma-delimited file MYFILE.TXT and send
  118.     the result to a text file named OUTPUT.TXT, you would enter this
  119.     command at the DOS prompt:
  120.  
  121.                          CCDF MYFILE.TXT OUTPUT.TXT
  122.  
  123.     This simple command will do the following:
  124.  
  125.     -- Read each line from MYFILE.TXT
  126.     -- Remove commas
  127.     -- Remove leading and trailing double-quotes for each field
  128.     -- Format the data into columns 20 characters wide
  129.     -- Write each new line to OUTPUT.TXT.
  130.  
  131.     You can select a different column width by specifying a third parameter
  132.     on the command line, as in this example:
  133.  
  134.                   CCDF C:\ZAPHOD\MARVIN.TXT ARTHUR.TXT 30
  135.  
  136.     This would read the comma-delimited file MARVIN.TXT (in the ZAPHOD
  137.     directory of drive C:) and output the result into 30-character wide
  138.     columns in the file ARTHUR.TXT.
  139.  
  140.     If an input field is longer than the specified column width, it is
  141.     truncated (i.e. chopped off) to fit.
  142.                                            
  143.  
  144.  
  145.                                 ===========
  146.                                 LIMITATIONS
  147.                                 ===========
  148.  
  149.  
  150.    Alas, CCDF can not read input lines longer than 255 characters.  If you
  151.    want more than that, you can either break up the lines manually, using a
  152.    macro editor, or pay me to write Version 2.00 of this product.
  153.  
  154.  
  155.  
  156.                                 ============
  157.                                 RETURN CODES
  158.                                 ============
  159.  
  160.  
  161.     If you are using CCDF in a batch (.BAT) file, you can check it for
  162.     successful operation by using the IF ERRORLEVEL function.  CCDF returns
  163.     an errorlevel of 0 (zero) if it worked, or 255 if it didn't.
  164.  
  165.  
  166.     IMPORTANT:  Remember that the IF ERRORLEVEL statement checks the
  167.                 indicated level AND HIGHER, so don't use IF ERRORLEVEL 0,
  168.                 because it will always be true.  Check the highest
  169.                 errorlevel first.
  170.  
  171.  
  172.     Here is an example of how to use CCDF in a batch file, along with some
  173.     explanatory comments:
  174.  
  175.  
  176.     +---------------------------------------------------------------------+
  177.     |                                                                     |
  178.     | @ECHO OFF                      <-- Turn off batch file echoing      |
  179.     | CCDF INPUT.TXT OUTPUT.TXT 50   <-- Run the CCDF command             |
  180.     | IF ERRORLEVEL 255 GOTO OOPS    <-- Jump ahead if there was an error |
  181.     | SEE OUTPUT.TXT                 <-- Use SEE to view output (Note 1)  |
  182.     | GOTO QUIT                      <-- Jump ahead to the end            |
  183.     | :OOPS                          <-- A batch file label               |
  184.     | ECHO Something didn't work!    <-- Report the error                 |
  185.     | :QUIT                          <-- A batch file label               |
  186.     | ECHO Finished!                 <-- Report the end of the file       |
  187.     |                                                                     |
  188.     | Fig. 3 -- Sample batch file using CCDF                              |
  189.     +---------------------------------------------------------------------+
  190.  
  191.  
  192.          NOTE 1:  The SEE file viewer/printer can be downloaded from
  193.                   Pinnacle Software's free files BBS at 514-345-8654.
  194.                   It is a freeware program, so you can use it for this
  195.                   and other projects without paying a license fee.
  196.  
  197.  
  198.  
  199.                             ===================
  200.                             GOING THE OTHER WAY
  201.                             ===================
  202.  
  203.  
  204.     CCDF can convert comma-delimited data to columnar, but what if you have
  205.     a columnar report (dumped to a text file) that you want converted to
  206.     comma-delimited format?  Fret not.  There's a convenient shareware
  207.     program named Parse-O-Matic (also by Pinnacle Software), which you can
  208.     download from our free files BBS at 514-345-8654.
  209.  
  210.     A lot of people have saved a LOT of money by using Parse-O-Matic,
  211.     because it lets them transfer data from one program to another without
  212.     retyping.
  213.  
  214.     Incidentally, the Parse-O-Matic package includes the SEE utility
  215.     mentioned in Fig. 3.
  216.  
  217.  
  218.  
  219.                             ====================
  220.                             WATCH CCDF IN ACTION
  221.                             ====================
  222.  
  223.  
  224.     The CCDF package contains a batch file, named CCDFDEMO.BAT, which
  225.     processes the file CCDFDEMO.DTA -- also included in the package.  To
  226.     run the demo, enter this at the DOS prompt:
  227.  
  228.                                   CCDFDEMO
  229.  
  230.     This will display the input, run CCDF, then show the output.
  231.  
  232.  
  233.  
  234.                                  =========
  235.                                  THANK-YOU
  236.                                  =========
  237.  
  238.  
  239.     Thank-you for taking the time to try out CCDF.  It's yours to use, free
  240.     of charge.  If you wish, you can pass along a copy to a friend or
  241.     associate.  However, bear in mind the following legal notice:
  242.  
  243.                                                                            
  244.     +---------------------------------------------------------------------+
  245.     |                                                                     |
  246.     |  YOU ARE ENTITLED TO USE CCDF v1.00 WITHOUT CHARGE PROVIDED YOU     |
  247.     |  INSTALL THE PRODUCT ON YOUR SYSTEM IN ITS ENTIRETY, WHICH IS TO    |
  248.     |  SAY THE FOLLOWING FILES:                                           |
  249.     |                                                                     |
  250.     |        READ.ME CCDF.DOC CCDF.EXE CCDFDEMO.BAT CCDFDEMO.DTA          |
  251.     |            AMAZE.DOC ORDER.FRM FILE_ID.DIZ VENDOR.DOC               |
  252.     |                                                                     |
  253.     |  YOU MAY ALSO GIVE COMPLETE AND UNALTERED COPIES WITH OTHERS AND    |
  254.     |  MAY CHARGE A SMALL FEE (NOT TO EXCEED U.S. $9) TO COVER YOUR       |
  255.     |  DUPLICATION AND/OR TRANSMISSION COSTS.  UNDER NO CIRCUMSTANCES     |
  256.     |  MAY YOU DISTRIBUTE ALTERED OR INCOMPLETE COPIES OF THIS PRODUCT.   |
  257.     |                                                                     |
  258.     |                                                                     |
  259.     | Fig. 4 -- Surly yet important legal notice about CCDF               |
  260.     +---------------------------------------------------------------------+
  261.  
  262.  
  263.     Whew.  If you are interested in some of Pinnacle Software's other
  264.     products, we have a special offer, which is explained in the text file
  265.     AMAZE.DOC.  To print it out, enter this command at the DOS prompt:
  266.  
  267.                             TYPE AMAZE.DOC >PRN
  268.  
  269.     If you like what you see there, you can print out the order form with
  270.     this command:
  271.  
  272.                             TYPE ORDER.FRM >PRN
  273.  
  274.     If you have any comments about CCDF, please let me know.  My name is
  275.     Tim, and you can reach me at 514-345-9578, or at CompuServe 70154,1577.
  276.  
  277.  
  278.  
  279.